package org.zpmis.domain.customer.vo;

import lombok.Data;
import org.zpmis.domain.customer.model.ReturnVisit;

import java.io.Serializable;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

@Data
public class QueryReturnVisitRecordVo {

    private Long id;

    /**
     * 意向表id
     */
    private Long intentionId;

    /**
     * 跟进人id
     */
    private Long chargePersonId;

    /**
     * 负责人、跟进人
     */
    private String chargePerson;

    /**
     * 回访日志
     */
    private String visitLog;

    /**
     * 企业名称
     */
    private String companyName;

    /**
     * 联系人
     */
    private String contactPerson;

    /**
     * 联系手机号
     */
    private String contactMobile;

    /**
     * 跟进结果 1无效客户2有效客户，3继续跟进
     */
    private Integer visitResult;

    /**
     * 结果描述
     */
    private String resultDesc;

    /**
     * 跟进计划
     */
    private String followPlan;

    /**
     * 回访方式 1电话2线下约谈
     */
    private Integer visitType;

    /**
     * 回访日期
     */
    private String visitTime;

    /**
     * 下次回访日期
     */
    private String visitNextTime;

    /**
     * 是否删除 0否1是
     */
    private Integer isDeleted;

    /**
     * 回访状态 1进行中2已完结
     */
    private Integer status;

    /**
     * 是否提醒 0否1是
     */
    private Integer isRemind;

    /**
     * 创建人id
     */
    private Long createId;

    /**
     * 创建人
     */
    private String createPerson;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 备注
     */
    private String remake;

    /**
     * 企业code
     */
    private String companyCode;

    /**
     * openId
     */
    private String openId;

    public QueryReturnVisitRecordVo(ReturnVisit returnVisit) {
        this.id = returnVisit.getId();
        this.intentionId = returnVisit.getIntentionId();
        this.chargePersonId = returnVisit.getChargePersonId();
        this.chargePerson = returnVisit.getChargePerson();
        this.visitLog = returnVisit.getVisitLog();
        this.companyName = returnVisit.getCompanyName();
        this.contactPerson = returnVisit.getContactPerson();
        this.contactMobile = returnVisit.getContactMobile();
        this.visitResult = returnVisit.getVisitResult();
        this.resultDesc = returnVisit.getResultDesc();
        this.followPlan = returnVisit.getFollowPlan();
        this.visitType = returnVisit.getVisitType();
        this.visitTime = returnVisit.getVisitTime() == null ? "" : LocalDateTime.ofInstant(Instant.ofEpochMilli(returnVisit.getVisitTime()), ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        this.visitNextTime =returnVisit.getVisitNextTime() == null ? "" : LocalDateTime.ofInstant(Instant.ofEpochMilli(returnVisit.getVisitNextTime()), ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        this.isDeleted = returnVisit.getIsDeleted();
        this.status = returnVisit.getStatus();
        this.isRemind = returnVisit.getIsRemind();
        this.createId = returnVisit.getCreateId();
        this.createPerson = returnVisit.getCreatePerson();
        this.createTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(returnVisit.getCreateTime()), ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        this.remake = returnVisit.getRemake();
        this.companyCode = returnVisit.getCompanyCode();
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", intentionId=").append(intentionId);
        sb.append(", chargePersonId=").append(chargePersonId);
        sb.append(", chargePerson=").append(chargePerson);
        sb.append(", visitLog=").append(visitLog);
        sb.append(", companyName=").append(companyName);
        sb.append(", contactPerson=").append(contactPerson);
        sb.append(", contactMobile=").append(contactMobile);
        sb.append(", visitResult=").append(visitResult);
        sb.append(", resultDesc=").append(resultDesc);
        sb.append(", followPlan=").append(followPlan);
        sb.append(", visitType=").append(visitType);
        sb.append(", visitTime=").append(visitTime);
        sb.append(", visitNextTime=").append(visitNextTime);
        sb.append(", isDeleted=").append(isDeleted);
        sb.append(", status=").append(status);
        sb.append(", isRemind=").append(isRemind);
        sb.append(", createId=").append(createId);
        sb.append(", createPerson=").append(createPerson);
        sb.append(", createTime=").append(createTime);
        sb.append(", remake=").append(remake);
        sb.append(", companyCode=").append(companyCode);
        sb.append("]");
        return sb.toString();
    }
}